<template>
  <div class="filters">
    <div class="btn" :class="{'cur':cur===''}" @click="changState('')">最相关</div>
    <div class="btn" :class="{'cur':cur==='newest'}" @click="changState('newest')">最新</div>
  </div>
</template>

<script setup>
import { ref, } from "vue";

defineProps({
    data: {
        type: Array,
        default: () => []
    }
});
const emit = defineEmits({
  'changState': null,
})
const cur = ref('')
const changState =(val)=>{
    cur.value=val;
    emit('changState',val)
}
</script>

<style lang="less" scoped>
.filters {
    margin: 20px 0;
    .btn {
        margin-right: 16px;
        display: inline-block;
        width: 80px;
        height: 32px;
        line-height: 32px;
        text-align: center;
        border-radius: 4px;
        background-color: #fff;
        cursor: pointer;
    }
    .cur {
        background-color: @theme-color;
        color: #fff;
    }
}
</style>
